﻿package mortal.game.view.guild.otherpanel
{
    import Message.Game.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.game.cache.*;
    import mortal.game.cache.guild.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;
    import mortal.game.view.shopMall.data.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuildImpeachLeaderPanel extends GuildOtherBasePanel
    {
        private var _txtImpeachRulesDesc:GTextFiled;
        private var _btnImpeach:GButton;
        private static var _instance:GuildImpeachLeaderPanel = null;

        public function GuildImpeachLeaderPanel(param1:ILayer = null)
        {
            super(param1);
            setSize(345, 205);
            title = "" + Language.getString(71174);
            return;
        }// end function

        override public function layoutUI() : void
        {
            var _loc_1:* = "<font size=\'12\' color=\'#FFCC00\'>1." + Language.getString(71175) + "</font><br>" + "<font size=\'12\' color=\'##0099FF\'>\t" + Language.getString(71176) + "</font><br>" + "<font size=\'12\' color=\'#FFCC00\'>2." + Language.getString(71177) + "</font><br>" + "<font size=\'12\' color=\'#0099FF\'>\t" + Language.getString(71178) + "</font>";
            this._txtImpeachRulesDesc = UIFactory.gTextField("", 15, 46, 320, 120, this, null, true);
            this._txtImpeachRulesDesc.multiline = true;
            this._txtImpeachRulesDesc.wordWrap = true;
            this._txtImpeachRulesDesc.htmlText = _loc_1;
            this._btnImpeach = UIFactory.gButton("" + Language.getString(71179), 123, 175, 108, 24, this);
            return;
        }// end function

        override public function onMouseClick(event:MouseEvent) : void
        {
            var _loc_2:SelfGuildInfo = null;
            var _loc_3:Boolean = false;
            var _loc_4:ShopItemData = null;
            switch(event.target)
            {
                case this._btnImpeach:
                {
                    _loc_2 = Cache.instance.guild.selfGuildInfo;
                    if (_loc_2.selfInfo.position != EGuildPosition._EGuildDeputyLeader && _loc_2.selfInfo.position != EGuildPosition._EGuildLeader && _loc_2.selfInfo.position != EGuildPosition._EGuildPresbyter)
                    {
                        MsgManager.showRollTipsMsg("" + Language.getString(71180));
                        return;
                    }
                    if (_loc_2.selfInfo.position == EGuildPosition._EGuildLeader)
                    {
                        MsgManager.showRollTipsMsg("" + Language.getString(71181));
                        return;
                    }
                    _loc_3 = Cache.instance.pack.backPackCache.getItemByCode(180070000) != null || Cache.instance.pack.backPackCache.getItemByCode(180071000) != null;
                    if (!_loc_3)
                    {
                        _loc_4 = ShopConfig.instance.getFastBuyItemByCode(180070000);
                        _loc_4.num = 1;
                        Dispatcher.dispatchEvent(new DataEvent(EventName.BuyItem, _loc_4));
                        return;
                    }
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GUILD_IMPEACH_LEADER, null));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public static function get instance() : GuildImpeachLeaderPanel
        {
            if (!_instance)
            {
                _instance = new GuildImpeachLeaderPanel;
            }
            return _instance;
        }// end function

    }
}
